#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#define GO(index) (go##index)

// first 和 second 不一样长
bool goAdd(char* longS, char* shortS){
	if(strlen(shortS) == 0){
		return true;
	}
	char *l = longS;
	char *s = shortS;
	bool isDif = true;
	do{
		if(*l != *s){
			if(isDif){
				isDif = false;
				if(*(++l) != *s){
					return false;
				}
			}else {
				return false;
			}
		}
		l++;
		s++;
	}while(*s != '\0');
	
	return true;
}

// first 与 second 一样长， 对frist替换
bool goAlter(char* first, char* second){
	if(strlen(first) == 0){
		return true;
	}
	char *f = first;
	char *s = second;
	bool isDif = true;
	do{
		if(*f != *s){
			if(isDif){
				isDif = false;
			}else {
				return false;
			}
		}
		f++;
		s++;
	}while(*f != '\0');
	
	return true;
}

bool oneEditAway(char* first, char* second){
	int difference_value = strlen(first) - strlen(second);
	return (difference_value == 1) ? (GO(Add))(first, second) : ((difference_value == -1) ? (GO(Add))(second, first) : ((difference_value == 0) ? (GO(Alter))(first, second) : false));
}


int main() {
	char *first = "pale";
	char *second = "ple";
	printf("%d\n", oneEditAway(first, second));
	
	first = "pales";
	second = "palas";
	printf("%d\n", oneEditAway(first, second));
}
